let mysql = require('mysql');
let pool = mysql.createPool({
    host:'127.0.0.1',
    user:'root',
    password:'',
    database:'friday',
});
function query(sql,cb,arr=[]){
    pool.getConnection((err,connect)=>{
        if(err){
            console.log(err+'连接失败');
            return;
        }
        connect.query(sql,arr,(err,res)=>{
            if(err){
                console.log(err+'执行失败');
                return;
            }
            cb(res);
            connect.release();
        });
    });
};
module.exports = query;